import java.util.*;

/**
 * @Question no4
 * @Date 2023/3/3 16:24
 * @Solution
 */
public class no4 {
    static int[][] dayNum=new int[][]{{0,31,28,31,30,31,30,31,31,30,31,30,31},
            {0,31,29,31,30,31,30,31,31,30,31,30,31}};
    static List<String> list = new ArrayList<>();
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str=scanner.nextLine();
        String[] strings = str.split("/");
        judge(strings[0],strings[1],strings[2]);
        judge(strings[1],strings[0],strings[2]);
        judge(strings[1],strings[2],strings[0]);
        list.sort(new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                String[] strings1 = o1.split("-");
                String[] strings2 = o2.split("-");
                if(Integer.parseInt(strings1[0])>Integer.parseInt(strings2[0])) {
                    return 1;
                } else if(Integer.parseInt(strings1[0])<Integer.parseInt(strings2[0])) {
                    return -1;
                } else {
                    if(Integer.parseInt(strings1[1])>Integer.parseInt(strings2[1])) {
                        return 1;
                    } else if(Integer.parseInt(strings1[1])<Integer.parseInt(strings2[1])) {
                        return -1;
                    } else {
                        if(Integer.parseInt(strings1[2])>Integer.parseInt(strings2[2])) {
                            return 1;
                        } else if(Integer.parseInt(strings1[2])<Integer.parseInt(strings2[2])) {
                            return -1;
                        } else {
                            return 0;

                        }
                    }
                }
            }
        });
        HashSet<String> hashSet = new LinkedHashSet<>();
        hashSet.addAll(list);
        for (String s : hashSet) {
            System.out.println(s);
        }
    }
    public static void judge(String year,String month,String day) {
        int year1=backYear(year);
        int month1=Integer.parseInt(month);
        int day1=Integer.parseInt(day);
        if(month1>12) {
            return;
        }
        if(isRun(year1)) {
            if(day1>dayNum[0][month1]) {
                return;
            }
        } else {
            if(day1>dayNum[1][month1]) {
                return;
            }
        }
        month=month1>=10?String.valueOf(month1):"0"+month1;
        day=day1>=10?String.valueOf(day1):"0"+day1;
        list.add(year1+"-"+month+"-"+day);
    }
    public static boolean isRun(int year) {
        if(year%4==0 && year%100!=0) {
            return true;
        } else if(year%400==0) {
            return true;
        } else {
            return false;
        }
    }
    public static int backYear(String s) {
        int num=Integer.parseInt(s);
        if(num<60) {
            return Integer.parseInt("20"+s);
        } else {
            return Integer.parseInt("19"+s);
        }
    }
}
